<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 作业
        // 用递归 解决 求阶乘
        // 用递归 解决 求阶乘和 (可以使用封装好的求阶乘的方法)

        function jc(n) {
            if (n == 1) {
                return 1;
            } else {
                return jc(n - 1) * n;
            }
        }
        console.log(jc(4));

        var leijia = 1;
        function jch(n1) {
            if(n1 == 1){
                return 1;
            }
            return jch(n1-1) + jc(n1);
        }
        console.log(jch(4));
    </script>
</body>

</html>